<template>
  <transition name="slide">
    <div class="modal" v-show="showModal">
      <div class="mask"></div>
      <div class="modal-dialog">
        <div class="modal-header">
          <span>{{title}}</span>
          <a href="javascript:;" class="icon-close" v-on:click="$emit('cancel')"></a>
        </div>
        <div class="modal-body">
          <slot name="body"></slot>
        </div>
        <div class="modal-footer">
          <a href="javascript:;" class="btn" v-if="btnTpye==1" v-on:click="$emit('submit')">{{sureText}}</a>
          <a href="javascript:;" class="btn" v-if="btnTpye==2" v-on:click="$emit('cancel')">{{canelText}}</a>
          <div class="btn-group" v-if="btnTpye==3">
            <a href="javascript:;" class="btn" v-on:click="$emit('submit')">{{sureText}}</a>
            <a href="javascript:;" class="btn" v-on:click="$emit('cancel')">{{canelText}}</a>
          </div>
        </div>
      </div>
    </div>
  </transition> 
</template>

<script>
export default {
  name:'modal',
  props:{
    //弹框类型：小small，中middle，大large，表单form
    modalType:{
      type:String,
      default:'form'
    },
    //天贶标题
    title:String,
    //按钮类型  1只有确定按钮  2取消按钮  3确定和取消
    btnTpye:String,
    sureText:{
      type:String,
      default:'确定'
    },
    cancelText:{
      type:String,
      default:'取消'
    },
    showModal:Boolean
  }
}
</script>

<style lang="scss">
@import "./../assets/mixin.scss";
@import "./../assets/config.scss";
@import "./../assets/modal.scss";
</style>